﻿Imports System.Data
Imports System.Data.Odbc
Imports WSEntidades
Imports MySql.Data.MySqlClient
Public Class CIeduFact
    Public Shared Function Build(ByVal dr As MySqlDataReader) As CIeduBE
        Dim tmpIedu As CIeduBE = New CIeduBE()
        Try
            With tmpIedu
                While dr.Read
                    If (dr.Item("CveComp") = "iedu") And (dr.Item("CveConfig") = "Preescolar") Then
                        .autRVOE_Preescolar = convertDTFromDb.ConvertString(dr.Item("Valor"))
                    End If
                    If (dr.Item("CveComp") = "iedu") And (dr.Item("CveConfig") = "Primaria") Then
                        .autRVOE_Primaria = convertDTFromDb.ConvertString(dr.Item("Valor"))
                    End If
                    If (dr.Item("CveComp") = "iedu") And (dr.Item("CveConfig") = "Secundaria") Then
                        .autRVOE_Secundaria = convertDTFromDb.ConvertString(dr.Item("Valor"))
                    End If
                    If (dr.Item("CveComp") = "iedu") And (dr.Item("CveConfig") = "Profesionaltecnico") Then
                        .autRVOE_Profesional = convertDTFromDb.ConvertString(dr.Item("Valor"))
                    End If
                    If (dr.Item("CveComp") = "iedu") And (dr.Item("CveConfig") = "BachilleratoEquiv") Then
                        .autRVOE_Bachillerato = convertDTFromDb.ConvertString(dr.Item("Valor"))
                    End If

                    Select Case convertDTFromDb.ConvertString(dr.Item("Status"))
                        Case "S"
                            .Status = CIeduBE.EstatusIEDU.Activa
                        Case Else
                            .Status = CIeduBE.EstatusIEDU.Inactiva
                    End Select
                End While

            End With
            Return tmpIedu
        Catch ex As Exception
            Throw
        Finally
            tmpIedu = Nothing
        End Try
    End Function

End Class
